/*
Copyright [2012] [Maria Eugenia Malagamba]
Copyright [2012] [Leandro Pellegrino]
Copyright [2012] [Julia Gambuzzi]
Copyright [2012] [Ignacio Capodanno]

   Licensed under the Apache License, Version 2.0 (the "License");
   you may not use this file except in compliance with the License.
   You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
*/

#pragma once
#define WIN32_LEAN_AND_MEAN

#include <windows.h>
#include <winsock2.h>
#include <ws2tcpip.h>
#include <stdlib.h>
#include <stdio.h>

#include<iostream>
#include <fstream>
#include <stdlib.h>

using namespace std;

//// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib
//#pragma comment (lib, "Ws2_32.lib")
//#pragma comment (lib, "Mswsock.lib")
//#pragma comment (lib, "AdvApi32.lib")

class Cliente{

private:

	string puerto;
	string direccionIp;

	WSADATA wsa;

	struct addrinfo* adressInfo;

public:
		SOCKET socketClient;
	Cliente(string puerto, string direccionIp);
	
	int crearSocket();
	int conectar();
	int enviar(char mensaje[],int longitud);
	int recibir(char mensaje[],int longitud);
	void cerrarConexion();

	int recibirEntero();
	int enviarEntero(int numero);
	string recibirString();
	int enviarString(string aEnviar);
	int recibirArchivo(string pathCliente);

	virtual ~Cliente();
};
